
function generateList(n) {
    if (!typeof n === 'number') return;
    const lists = [['a', 'b', 'c'], ['b', 'c', 'a'], ['c', 'a', 'b']];
    const info = [];
    for (let i = 0; i < n; i++) {
        const count1 = Math.floor(i / 3) % 3;
        info.push(lists[count1][i % 3]);
    }
    const strList = [];
    for (let i = 0; i < info.length; i += 3) {
        strList.push(info.slice(i, i + 3));
    }

    return strList;
}
const list = generateList(12);
console.log(list);